<?php

class Core_Controllers_View {

    private $strControllerName;
    private $strActionName;

    function __construct ( $strControllerName, $strActionName ) {
        $this->strControllerName = $strControllerName;
        $this->strActionName = $strActionName;
    }

    public function dispatch () {
        require_once Core_Directories::VIEWS . $this->strControllerName . "/" . $this->strActionName . "View.php";
    }

    /**
     * Gets the contents of a file in the views directory.
     * 
     * @param string $strURI URI to the file below the views directory.
     * @return string The content of the file.
     */
    public function load ( $strURI ) {

        $resFile = fopen( Core_Directories::VIEWS . $strURI, "r" );
        $strContents = fread( $resFile, filesize( Core_Directories::VIEWS . $strURI ) );
        fclose( $resFile );

        return $strContents;

    }

}

?>
